package com.lc.recovery.ui.activity;

import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

import com.hjq.bar.TitleBar;
import com.hjq.http.EasyHttp;
import com.hjq.http.listener.HttpCallback;
import com.lc.recovery.R;
import com.lc.recovery.app.AppActivity;
import com.lc.recovery.bean.XieYiBean;

import butterknife.BindView;
import butterknife.ButterKnife;

public class XieYiActivity extends AppActivity {
    @BindView(R.id.tv_xieyi)
    TextView tvXieyi;
    @BindView(R.id.title_bar)
    TitleBar titleBar;
    private String id;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_xieyi;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
        id = getIntent().getStringExtra("id");
        xieyi();
    }

    private void xieyi() {

        EasyHttp.post(this)
                .api(new AgreementApi()
                        .setId(id))
                .request(new HttpCallback<XieYiBean>(this) {


                    @Override
                    public void onSucceed(XieYiBean data) {
                        if (data.getCode() == 200) {
                            tvXieyi.setText(Html.fromHtml(data.getData().getContent()));
                             titleBar.setTitle(data.getData().getTitle());
                        } else {

                            toast(data.getMsg());

                        }


                    }


                });
    }
}
